/*************************************************************************
> File Name: main.cpp
> Author: hzy
> Created Time: 2023-08-23 17:16:29
> Description:
************************************************************************/
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <time.h>
#include <deque>

using namespace std;

class Person
{
private:
    string name;  // 存储选手姓名
    int score[3]; // 存储选手得分信息，一共有三轮使用3个元素的一维数组存储

public:
    Person()
    {
        memset(this, 0, sizeof(Person));
    }
    Person(string name)
    {
        this->name = name;
        memset(score, 0, sizeof(int) * 3);
    }

    friend void CreatePerson(vector<int> &v, map<int, Person> &m);
    friend void PrintPerson(vector<int> &v, map<int, Person> &m);
};

void CreatePerson(vector<int> &v, map<int, Person> &m)
{
    string tempname = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    for (int i = 100; i < 124; i++)
    {
        // 插入选手编号
        v.push_back(i);
        // 插入选手姓名
        string name = "选手";
        name += tempname[i - 100];
        m.insert(make_pair(i, Person(name)));
    }
}

void PrintPerson(vector<int> &v, map<int, Person> &m)
{
    for (vector<int>::iterator it = v.begin(); it != v.end(); it++)
    {
        cout << *it << ":" << m[*it].name << endl;
    }
}

void playGame(vector<int> &v, map<int, Perosn> &m, int round)
{
    srand(time(NULL));
    // 打乱顺序
    random_shuffle(v.begin(), v.end());

    vector<int>::iterator it = v.begin();
    for (; it != v.end(); it++)
    {
        // 存储评委的分数
        deque<int> dq;
        for (int i = 0; i < 10; i++)
        {
            dq.push_back(rand() % 41 + 60);
        }

        // deque容器排序
        sort(dq.begin(), dq.end());

        // 去掉最高分和最低分
        dq.pop_back();
        dq.pop_front();

        // 计算平均分
        int average = accumulate(dq.begin(), dq.end(), 0) / dq.size();
        m[*it].score[round - 1] = average;

        multimap<int, int, greater<int>> mp;
        // mp.insert();
    }
}

int main()
{
    vector<int> v1; // 存储所以选手编号
    map<int, Person> m;
    // 1.创建参赛选手的容器存储
    CreatePerson(v1, m);
    PrintPerson(v1, m);

    return 0;
}